#pragma once

#include "Device.h"

#define FONT_NUMBER 95
#define FONT_LETTER_WIDTH 32
#define FONT_OFFSET 16

namespace Graphics
{
	class Texture;
}

namespace Graphics
{
struct FontType
{
	float left, right;
	int size;
};

struct FontVertexType
{
	D3DXVECTOR3 position;
	D3DXVECTOR2 texture;
};

class Font
{
public:
	Font(void);
	virtual ~Font(void);
	virtual bool Initialize(const char* fontFilename, const char* textureFilename);
	virtual void Deinitialize();
	void BuildVertexArray(void* vertices, const char* sentence, float drawX, float drawY);
#ifdef DX_9
	void Render(const std::string& text, int x = 0, int y = 0);
#endif
	Texture* GetTexture();
private:	
	bool LoadFontData(const char* fileName);
	void ReleaseFontData();

#ifdef DX_11
	FontType* mFont;
	Texture* mFontTexture;
#elif defined(DX_9)
	ID3DXFont* mFont;
#endif
};
}